Basic Transformation
General Transformation Any rigid transformation in 3D Cartesian space can be simplified as a translation and a rotation, exclusively in that order. Let \vec{d} be a position vector of point d . Let us say that a sequence of transformation is applied to point d Assume that the equivalent translation is \vec{p} , and rotation is R . A 4x4 homogeneous transformation matrix is equal to H=\begin{bmatrix} R & \vec{p} \\ 0_{1\times3} & 1\end{bmatrix} The transformed point can be computed as the followings. \begin{bmatrix}\vec{d}'\\1\end{bmatrix}=\begin{bmatrix} R & \vec{p} \\ 0_{1\times3} & 1\end{bmatrix}\begin{bmatrix}\vec{d} \\ 1\end{bmatrix} Note: Translating a point then rotating the point isn't necessarily equivalent to rotating the point then translating the point. Note: \vec{p} and R aren't necessarily the actual motion. They are just equivalent motion, which is can be conveniently described by 4x4 homogeneous transformation matrix. Basic Translation To translate the point along the direction of vector \vec{d} , the equivalent rotation matrix is an identity matrix because there is no rotation. Hence, the transformation matrix is the following. Transl(\vec{d})=\begin{bmatrix} I_3 & \vec{p} \\ 0_{1\times3} & 1\end{bmatrix} Note: It might be more intuitive to just add the vector p to position vector d . However, if multiple transformations are applied to a point, it is easier to have a successive matrix multiplication than to have a combination of multiplication and addition. For further derivation, we will adopt a new notation for translating a point along the standard axes, \hat{x} , \hat{y} , and \hat{z} . A translation of a along \hat{x} can be represented by the following. Transl(a,\hat{x})=\begin{bmatrix} 1 & 0 &0&a \\ 0&1&0&0\\ 0& 0&0&0\\0&0&0&1\end{bmatrix} The same principle are applied with translation along \hat{y} and \hat{z} . The fourth column of the matrix describe the amount of translation. The translation in y-direction is described by the entry in the second row, fourth column. Basic Rotation To rotate a point, one must define an axis of rotation. Note that different sequences of rotations can result in the same transformation, i.e. turning right (90 degrees) 3 times is equivalent to turning left once. For the simplicity of the calculation, we only discuss the rotation about standard axes, \hat{x} , \hat{y} , and \hat{z} . In 3 dimensional Cartesian space, a rotation of \phi about \hat{x} can be represented by the following 4x4 homogeneous transformation matrix. Rot(\phi,\hat{x})=\begin{bmatrix}1 & 0 & 0 & 0\\ 0 &\cos(\phi) &-\sin(\phi)&0 \\ 0 &\sin(\phi)& \cos(\phi)&0\\0&0&0&1\end{bmatrix} A rotation of \theta about \hat{y} can be represented by the following. Rot(\theta,\hat{y})=\begin{bmatrix} \cos(\theta) & 0 &\sin(\theta)&0 \\ 0&1&0&0\\ -\sin(\theta)& 0&\cos(\theta)&0\\0&0&0&1\end{bmatrix} A rotation of \psi about \hat{z} can be represented by the following. Rot(\psi,\hat{z})=\begin{bmatrix} \cos(\psi) &-\sin(\psi)& 0&0 \\ \sin(\psi)&\cos(\psi)& 0&0\\0&0&1&0\\ 0&0&0&1\end{bmatrix} Fixed Frame versus Transformed (Current) Frame So far, we know how to construct a transformation matrix from an individual motion. To apply successive transformations, one must understand the frame of transformation. Starting of with the first transformation matrix T_0 , the subsequent transformation matrix T_1 is multiplied to the end of T_0 if the transformation is applied with respect to the fixed frame. Note that this does not use the new transformed axes. T_{fixed}=T_0T_1 One you transformed an object, you may be interested in applying transformation in the new transformed coordinate frame. In that case, the subsequent transformation matrix T_1 is multiplied to the front of T_0 . T_{current}=T_1T_0 A sequence of transformations may consists of both cases. Therefore, one must be cautious about the frame of transformation. Describing and Orientation using Rotation Matrix Given a global reference frame, describing an orientation of an object can be a difficult task without understanding the concept of frame of transformation. There are many ways to describe an orientation. For now, we will discuss briefly about ZXZ-Euler Angles, and Roll-Pitch-Yaw Angles conventions. ZXZ-Euler Angles ZXZ-Euler Angles consists of 3 successive rotations about current axes in the following order #rotating about current z-axis for \phi #rotating about current x-axis for \theta #rotating about current z-axis for \psi The result rotation matrix is the following. R_{zxz}(\phi,\theta,\psi)= \begin{bmatrix}\cos\psi\cos\phi-\cos\theta\sin\phi\sin\psi & \cos\psi\sin\phi-\cos\theta\cos\phi\sin\psi &\sin\psi\sin\theta \\ -\sin\psi\cos\phi-\cos\theta\sin\phi\cos\psi & -\sin\psi\sin\phi+\cos\theta\cos\phi\cos\psi &\cos\psi\sin\theta \\ \sin\theta\sin\phi & -\sin\theta\cos\phi &\cos\theta\end{bmatrix} Roll-Pitch-Yaw Angles Roll-Pitch-Yaw Angles consists of 3 successive rotations about the fixed axes in the following order #rotating about fixed x-axis for \alpha #rotating about fixed y-axis for \beta #rotating about fixed z-axis for \gamma The result rotation matrix is the following. R_{rpy}(\alpha,\beta,\gamma)= \begin{bmatrix}\cos\alpha\cos\beta & \cos\alpha\sin\beta\sin\gamma-\sin\alpha\cos\gamma & \cos\alpha\sin\beta\cos\gamma+\sin\alpha\sin\gamma\\ \sin\alpha\cos\beta &\sin\alpha\sin\beta\gamma+\cos\alpha\cos\gamma & \sin\alpha\sin\beta\cos\gamma-\cos\alpha\sin\gamma \\ -\sin\beta & \cos\beta\sin\gamma & \cos\beta\cos\gamma\end{bmatrix}